package com.example.demo0912_thymeleaf.controller;

import com.example.demo0912_thymeleaf.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

@Controller
public class ThymeleafController {

    @RequestMapping("/test")
    public String test(Map<String,Object> map){
        List<String> list = Arrays.asList("DJ喜羊羊","MC懒羊羊","第一深情沸羊羊");
        map.put("nameList",list);
        map.put("value","确认");
        map.put("href","https://www.baidu.com");
        map.put("newclass","new");
        map.put("pic1","/imgs/coffee.png");

        List<User> userList = new ArrayList<>();
        userList.add(new User(1,"Houtin"));
        userList.add(new User(2,"Terry"));
        userList.add(new User(3,"Sky"));
        map.put("users",userList);
        return "hello";
    }
}
